<?php
App::uses('AppIndexController', 'Controller');
/**
 * Accounts Controller
 *
 * @property Account $Account
 * @property PaginatorComponent $Paginator
 * @property SessionComponent $Session
 */
class UsersController extends AppIndexController {
    public function beforeFilter() {
        parent::beforeFilter();
    }

    public function login() {
        if ($this->request->is('post')) {
//            if ($this->Auth->login()) {
//                return $this->redirect($this->Auth->redirectUrl());
//            }

         //   $this->Session->setFlash(__('Invalid username or password, try again'));
            return $this->redirect(array('controller' => 'modells','action' => 'index'));
        }
    }

    public function logout() {
        return $this->redirect($this->Auth->logout());
    }

    public function add() {
        if ($this->request->is('post')) {
            $this->Account->create();
            if ($this->Account->save($this->request->data)) {
                $this->Session->setFlash(__('The account has been saved.'));
                return $this->redirect(array('action' => 'index'));
            } else {
                $this->Session->setFlash(__('The account could not be saved. Please, try again.'));
            }
        }
        $this->set(compact('roles'));
    }

}
